// router/index.js
import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL || '/'),
  routes: [
    {
      path: '/',
      redirect: '/login'
    },
    { path: '/login', component: () => import('../views/LoginView.vue') },
    { path: '/home', component: () => import('../views/home/HomeView.vue') },
    {
      path: '/admin',
      name: 'admin',
      component: () => import('../views/admin/AdminView.vue'),
      children: [
        {
          path: '/doctor', // 相对路径
          name: 'doctor',
          component: () => import('../views/admin/doctor/DoctorView.vue'),
        },
        {
          path: '/hospital', // 相对路径
          name: 'hospital',
          component: () => import('../views/admin/hospital/HospitalView.vue'),
        },
        {
          path: '/patient', // 相对路径
          name: 'patient',
          component: () => import('../views/admin/patient/PatientView.vue'),
        },
        {
          path: '/subject', // 相对路径
          name: 'subject',
          component: () => import('../views/admin/subject/SubjectView.vue'),
        },
        {
          path: '/drug', // 相对路径
          name: 'drug',
          component: () => import('../views/admin/drug/DrugView.vue'),
        },
        {
          path: '/disease', // 相对路径
          name: 'disease',
          component: () => import('../views/admin/disease/DiseaseView.vue'),
        },
        {
          path: '/reservation', // 相对路径
          name: 'reservation',
          component: () => import('../views/admin/reservation/ReservationView.vue'),
        },
      ]

    },
    {
      path: '/home',
      name: 'home',
      component: () => import('../views/home/HomeView.vue'),
      children: [
        {
          path: '/guide', // 相对路径
          name: 'guide',
          component: () => import('../views/home/guide/GuideView.vue'),
        },
        {
          path: '/expert', // 相对路径
          name: 'expert',
          component: () => import('../views/home/expert/ExpertView.vue'),
        },
        {
          path: '/index', // 相对路径
          name: 'index',
          component: () => import('../views/home/index/IndexView.vue'),
        },
        {
          path: '/introduction', // 相对路径
          name: 'introduction',
          component: () => import('../views/home/introduction/IntroductionView.vue'),
        },
        {
          path: '/news', // 相对路径
          name: 'news',
          component: () => import('../views/home/news/NewView.vue'),
        },
        {
          path: '/seekguide', // 相对路径
          name: 'seekguide',
          component: () => import('../views/home/seekguide/SeekGuideView.vue'),
        },
        {
          path: '/service', // 相对路径
          name: 'service',
          component: () => import('../views/home/service/ServiceView.vue'),
        },
      ]
    },
  ],
})

export default router
